package org.looop.studio.bean.desc.impl;

import java.lang.reflect.InvocationTargetException;

import org.looop.studio.bean.desc.ValueDesc;
import org.looop.studio.bean.domain.BeanDefinition;
import org.looop.studio.bean.factory.BeanFactory;

public class BeanValueDesc implements ValueDesc{
	private BeanDefinition beanDefinition;
	
	public BeanDefinition getBeanDefinition() {
		return beanDefinition;
	}

	public void setBeanDefinition(BeanDefinition beanDefinition) {
		this.beanDefinition = beanDefinition;
	}

	public BeanValueDesc(BeanDefinition beanDefinition) {
		super();
		this.beanDefinition = beanDefinition;
	}

	@Override
	public Object getValue(BeanFactory beanFactory)
			throws IllegalArgumentException, SecurityException,
			InstantiationException, IllegalAccessException,
			ClassNotFoundException, InvocationTargetException,
			NoSuchMethodException {
		return beanFactory.createBean(beanDefinition);
	}

}
